//
//  SearchNavView.m
//  MyProject
//
//  Created by 石小强 on 2018/4/18.
//  Copyright © 2018年 yanjiaming. All rights reserved.
//

#import "SearchNavView.h"

@implementation SearchNavView

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        [self initSubViews];
    }
    return self;
}

- (void)initSubViews {
    _backView = [[UIView alloc] initWithFrame:CGRectMake(15, 7, kScreenWidth - 65, 30)];
    _backView.backgroundColor = UIColorFromRGB(0xF2F5FA);
    _backView.layer.cornerRadius = 15;
    _backView.layer.masksToBounds = YES;
    [self addSubview:_backView];
    
    UIImageView *searchIV = [[UIImageView alloc] initWithFrame:CGRectMake(15, 8, 14, 14)];
    searchIV.image = [UIImage imageNamed:@"ic_search_small"];
    [_backView addSubview:searchIV];
    
    _searchTF = [[UITextField alloc] initWithFrame:CGRectMake(39, 0, _backView.mj_w - 39, 30)];
    _searchTF.placeholder = @"搜索";
    _searchTF.font = [UIFont fontWithName:@"PingFang SC" size:14];
    _searchTF.returnKeyType = UIReturnKeySearch;
    [_backView addSubview:_searchTF];
    
    _cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(kScreenWidth - 50, 0, 50, 44)];
    [_cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
    [_cancelBtn setTitleColor:UIColorFromRGB(0x1AA9BA) forState:UIControlStateNormal];
    _cancelBtn.titleLabel.font = [UIFont fontWithName:@"PingFang SC" size:14];
    [self addSubview:_cancelBtn];
}

@end
